package com.example.controller;
 
import jakarta.annotation.Resource;
import org.springframework.ai.ollama.OllamaChatModel;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
 
@RestController
public class ChatController {
 
    @Resource
    private OllamaChatModel chatModel;
 
    @GetMapping("/chat")
    public String generate(@RequestParam String prompt) {
        return chatModel.call(prompt);
    }
}